package cn.itlaobing.web.dao;

import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import cn.itlaobing.web.model.ListModel;

public class ListDao {
	private DBhelper db=new DBhelper();
	public List<ListModel> queryOne(Integer userid) throws SQLException,IOException{
		String sql="select * from tbl_list where userid=?";
		ResultSet rs=db.executeQuery(sql,userid);
		List<ListModel> list=new ArrayList<ListModel>();
		while(rs.next()) {
			ListModel lm=new ListModel();
			lm.setAttutide(rs.getString("attutide"));
			lm.setId(rs.getInt("id"));
			lm.setListfrom(rs.getString("listfrom"));
			lm.setListid(rs.getString("listid"));
			lm.setSums(rs.getDouble("sums"));
			lm.setThistime(rs.getString("thistime"));
			lm.setToaddress(rs.getString("toaddress"));
			lm.setToname(rs.getString("toname"));
			lm.setTotele(rs.getString("totele"));
			lm.setUserid(rs.getInt("userid"));
			list.add(lm);
		}
		return list;
	}
	public void close() throws SQLException{
		db.close();
	}
}
